/* This class is the template for weapons
 * 
 */

package item.weapon;


import java.util.ArrayList;
import java.util.Random;

import status.Status;

import item.Rarity;
import item.ItemTemplate;


public class WeaponTemplate extends ItemTemplate{

	private final Status effect; //the effect the weapon has
	private final int bStrength; //the strength of the effect
	private final int lStrength; //the strength per level of the effect
	private final int brStrength; //the base random strength gain
	private final int lrStrength; //the random strength gain per level
	private final int bDuration; //the base duration
	private final int lDuration; //the change in duration per level
	private final int bHitRate; //the base hit rate of the weapon
	private final int rHitRate; //the max amount of random hit rate
	private final int numShots; //the number of shots
	private final int minRange; //the minimum range of the weapon
	private final int maxRange; //the maximum range of the weapon
	private final int radius; //the radius of the shot
	private final Target target; //the types of spaces the weapon can target
	private final int aPen; //the armor penetration of the shot
	private final int sPen; //the shields penetration of the shot
	private final int ap; //the amount of ap taken to fire the weapon
	private final int wepCooldown; //the cooldown of the weapon
	private final ArrayList<String> allowClass; //the classes allowed to use
		//the weapon
	private final ArrayList<String> reqAttributes; //the attributes that are 
		//required to use the weapon
	private final ArrayList<String> resAttributes; //the attributes that the
		//ship equipping the weapon cannot have
	
	
	public WeaponTemplate(String n, int minl, int maxl, int bc, int lc, int bw,
			int lw, String sP, Rarity r, Status e, int bStr, int lStr, int brs,
			int lrs,int bDur, int lDur, int bhr, int rhr, int nS, int nRan,
			int xRan, int rad, Target tar, int ape, int spe, int a, int wepCd,
			ArrayList<String> aCl, ArrayList<String> req,
			ArrayList<String> res){
		
		super(n, minl, maxl, bc, lc, bw, lw, sP, r);
		
		effect = e;
		bStrength = bStr;
		lStrength = lStr;
		brStrength = brs;
		lrStrength = lrs;
		bDuration = bDur;
		lDuration = lDur;
		bHitRate = bhr;
		rHitRate = rhr;
		numShots = nS;
		minRange = nRan;
		maxRange = xRan;
		radius = rad;
		target = tar;
		aPen = ape;
		sPen = spe;
		ap = a;
		wepCooldown = wepCd;
		allowClass = aCl;
		reqAttributes = req;
		resAttributes = res;
	}//30 param constructor


	//returns a weapon generated using this template
	public Weapon generate(int l) {

		Random r = new Random();
		
		int c = this.getbCost() + (l * this.getlCost());
		int w = this.getbWeight() + (l * this.getlWeight());
		int str = bStrength + (l * lStrength) + (r.nextInt(brStrength +
				lrStrength));
		int dur = bDuration + (l * lDuration);
		int hr = bHitRate + r.nextInt(rHitRate);
		
		return new Weapon(this.getName(), c, w, this.getSpritePath(),
				this.getRarity(), effect, str, dur, hr, numShots, minRange,
				maxRange, radius, target, aPen, sPen, ap, wepCooldown,
				allowClass, reqAttributes, resAttributes);
	}//generate	
}//WeaponTemplate